The TextField Component > FTextField.isValid()

 

FTextField.isValid()

Availability

Flash Player 6.

Usage

myTextField_txf.isValid ()

Parameters

None.

Returns

If a function has been passed into the setValidationFunction method the return of this function will be returned, otherwise this method returns true.

Description

If a function has been passed into the setValidationFunction method the return of this function will be returned, otherwise this method returns true. This method can be used in conjunction with the setValidationFunction method to easily validate user input.

Example

The text_validation.fla example file contains an example of using this method.

The following code defines a validation function that checks for less than six characters.

function validate(text){
   if(text.length<6)  return false;
   else return true;
}

myTextField_txf.setValidationFunction("validate");
myTextField_txf.txt = "foo"

trace(myTextField_txf.isValid());//traces false

 

See also

FTextField.setValidationFunction()